<!
 ============================================================================
 Name        : upload.php
 Author      : Stefan Nagel
 Version     : 0.0.1
 Copyright   : 2014 Stefan Nagel
 	 	 	 	This file is part of the BringYourOwnDevice application.
				BringYourOwnDevice is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
				BringYourOwnDevice is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
				You should have received a copy of the GNU General Public License along with zeitmessanlage. If not, see http://www.gnu.org/licenses/.
  Description : Php script to upload a file. This code snippet is taken from:
				http://www.w3schools.com/php/php_file_upload.asp
 ============================================================================
 >

<?php
if ($_FILES["file"]["error"] > 0)
{
  echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else
{
  echo "Upload: "	 . $_FILES["file"]["name"] 			. "<br>";
  echo "Type: " 	 . $_FILES["file"]["type"] 			. "<br>";
  echo "Size: " 	 . ($_FILES["file"]["size"] / 1024) . " kB<br>";
  echo "Temp stored: " . $_FILES["file"]["tmp_name"] 	. " kB<br>";
  
  if (file_exists("upload/" . $_FILES["file"]["name"]))
  {
      echo $_FILES["file"]["name"] . " already exists. ";
  }
  else
  {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
  }
}


?> 